import { useFrame } from '@react-three/fiber';
import React, { useRef } from 'react';
import * as THREE from 'three';

const geometry = new THREE.CylinderGeometry(600, 600, 1700, 40, 10);
geometry.applyMatrix4(new THREE.Matrix4().makeRotationX(-Math.PI / 2));

const Land = () => {
  const land = useRef<THREE.Group>(null);
  useFrame((state, delta) => {
    if (land.current) {
      land.current.rotation.z += delta * 0.2;
    }
  });

  return (
    <group ref={land} position-y={-600}>
      <mesh geometry={geometry} receiveShadow>
        <meshPhongMaterial color={0x629265} flatShading />
      </mesh>
    </group>
  );
};

export default Land;
